<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.prime.com.tr/ui" xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets" template="/template/main.xhtml">

	<ui:define name="body">
		<h:form>
			<p:toolbar>
				<p:toolbarGroup align="left">					
					<p:commandButton title="#{messages['button.delete']}" image="ui-icon-trash" onclick="confirmation.show()"
						type="button" immediate="true" ajax="false" />

					<p:confirmDialog message="#{messages['label.confirm.delete']}" showEffect="bounce" hideEffect="explode"
						header="#{messages['label.dialog.alert']}!" severity="alert" widgetVar="confirmation">

						<h:commandButton value="#{messages['button.dialog.yes']}" action="#{genericListMB.deleteSelection}"
							actionListener="#{bookmarkListMB.clear}" />
						<h:commandButton value="#{messages['button.dialog.no']}" onclick="confirmation.hide()" type="button" />
					</p:confirmDialog>
				</p:toolbarGroup>
			</p:toolbar>

			<p:dataTable id="list" var="bean" value="#{shoppingCartListMB.resultList}">
				<f:facet name="header">!!!Carrinho de compras</f:facet>
				<p:column style="width:5%;">
					<h:selectBooleanCheckbox value="#{shoppingCartListMB.selection[bean.id]}" />
				</p:column>
				
				<p:column sortBy="#{bean.product.id}">
					<f:facet name="header">!!!ID</f:facet>
					<h:commandLink action="#{shoppingCartListMB.getNextView}" actionListener="#{shoppingCartListMB.clear}">
						<h:outputText value="#{bean.id}" />
						<f:param name="id" value="#{bean.id}" />
					</h:commandLink>
				</p:column>
								
				<p:column sortBy="#{bean.product.itemName}">
					<f:facet name="header">!!!Nome</f:facet>
					<h:commandLink action="#{shoppingCartListMB.getNextView}" actionListener="#{shoppingCartListMB.clear}">
						<h:outputText value="#{bean.product.itemName}" />
						<f:param name="id" value="#{bean.id}" />
					</h:commandLink>
				</p:column>
				<p:column sortBy="#{bean.unitPrice}">
					<f:facet name="header">!!!Valor Unitario</f:facet>
					<h:commandLink action="#{shoppingCartListMB.getNextView}" actionListener="#{shoppingCartListMB.clear}">
						<h:outputText value="#{bean.product.price}" />
						<f:param name="id" value="#{bean.id}" />
					</h:commandLink>
				</p:column>
				<p:column sortBy="#{bean.quantity}">
					<f:facet name="header">!!!Quantidade</f:facet>
					<h:commandLink action="#{shoppingCartListMB.getNextView}" actionListener="#{shoppingCartListMB.clear}">
						<h:outputText value="#{bean.quantity}" />
						<f:param name="id" value="#{bean.id}" />
					</h:commandLink>
				</p:column>
				<p:column sortBy="#{bean.disccount}">
					<f:facet name="header">!!!Desconto</f:facet>
					<h:commandLink action="#{shoppingCartListMB.getNextView}" actionListener="#{shoppingCartListMB.clear}">
						<h:outputText value="#{bean.disccount}" />
						<f:param name="id" value="#{bean.id}" />
					</h:commandLink>
				</p:column>
				<p:column sortBy="#{bean.shipping}">
					<f:facet name="header">!!!Frete</f:facet>
					<h:commandLink action="#{shoppingCartListMB.getNextView}" actionListener="#{shoppingCartListMB.clear}">
						<h:outputText value="#{bean.shipping}" />
						<f:param name="id" value="#{bean.id}" />
					</h:commandLink>
				</p:column>
				<p:column sortBy="#{bean.total}">
					<f:facet name="header">!!!Valor Total</f:facet>
					<h:commandLink action="#{shoppingCartListMB.getNextView}" actionListener="#{shoppingCartListMB.clear}">
						<h:outputText value="#{bean.product.price}" />
						<f:param name="id" value="#{bean.id}" />
					</h:commandLink>
				</p:column>					
				<p:column>
					<h:commandButton value="!!!Pagar" action="#{shoppingCartListMB.payItem()}" >
						<f:param name="sellId" value="#{bean.id}" />
					</h:commandButton>
				</p:column>
													
			</p:dataTable>
		</h:form>
	</ui:define>
</ui:composition>